home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Form / Sources / Views.fr < prev   
Encoding:
Text File  |  1996-08-16  |  16.7 KB  |  562 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //    File:                Views.fr
  3. //    Release Version:    $ ODF 1 $
  4. //
  5. //    Contains:            Resources defining the Form part's views
  6. //
  7. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  8. //========================================================================================
  9.  
  10. #ifndef FWRESFIL_K
  11. #include "FWResFil.k"
  12. #endif
  13.  
  14. #ifndef FWVIEWS_FR
  15. #include "FWViews.fr"
  16. #endif
  17.  
  18. #ifndef FWNOTDEF_H
  19. #include "FWNotDef.h"     
  20. #endif
  21.  
  22. #ifndef DEFINES_K
  23. #include "Defines.k"
  24. #endif
  25.  
  26. //========================================================================================
  27. // Defines
  28. //========================================================================================
  29.  
  30. // H & V are reference size for the Form frame.
  31. // Their values are not important because all the views will be resized at runtime 
  32. // to adjust to the real frame size defined by the part. What is important is the 
  33. // placement of the subviews relative to this reference size and their binding flags.
  34. // Note: in this example the bounds & bindings of RFormView, the content view, are not 
  35. // important either because the frame takes care of it in CFormView::CenterInFrame() 
  36.  
  37. #define H    FW_FIX(600)
  38. #define V    FW_FIX(1000)
  39.  
  40. #define H1    H + FW_FIX(1)
  41. #define V1    V + FW_FIX(1)
  42.  
  43. // Fonts not defined in "FWViews.fr"
  44. #define TIMES_12_BOLD        { FW_FIX(12), FW_kBold, "Times" }
  45.  
  46. //========================================================================================
  47. // type RFormView
  48. //========================================================================================
  49.  
  50. type RFormView : FW_RSuperView(Label='Frmv')
  51. {
  52.     // This form uses 3 radio-clusters (not included in FW_RSuperView)
  53.     // The code to load them is in CFormView::InitializeFromStream().
  54.     
  55.     FW_RRadioCluster;    
  56.     FW_RRadioCluster;    
  57.     FW_RRadioCluster;
  58. };
  59.  
  60. //========================================================================================
  61. // type RScrollEdit
  62. //========================================================================================
  63. // Custom scrolling edit view 
  64.  
  65. type RScrollEdit : FW_REditView(Label='Sedv')
  66. {
  67. HorizViewID:
  68.     longint;            // Horizontal scrollbar id, or 0 for no scrollbar
  69. VertViewID:
  70.     longint;            // Vertical scrollbar id, or 0 for no scrollbar
  71. TextWidth:
  72.     FW_RFixed;            // text width (or 0 to use same width as view)
  73. };
  74.  
  75. //========================================================================================
  76. // resource RFormFrame(kFormView)
  77. //========================================================================================
  78. // See constants in "FWViews.k", macros & resource types in "FWViews.fr"
  79.  
  80. resource FW_RFrameLayout(kFormView)
  81. {
  82.     {H,V},                    // LayoutSize
  83.     {                        // Start list of frame's subviews
  84.         RFormView
  85.         (
  86.             kFormViewID,                // view id
  87.             {0, 0, H, V},                // bounds
  88.             FW_kFitToEnclosure,            // bindings
  89.             {FW_FIX(560),FW_FIX(800)},    // extent
  90.             1,                            // Make it the ContentView
  91.             FW_kXYScrolling,            // scrolling direction
  92.             {                            // Start list of SubViews
  93.                 FW_REditView    // First name
  94.                 (
  95.                     kFirstNameEdViewID,                // view id
  96.                     { FW_FIX(290),FW_FIX(90),FW_FIX(450),FW_FIX(107)},
  97.                     FW_kFixedBounds,                // binding
  98.                     20,                                // max chars
  99.                     9,                                // attributes
  100.                     TIMES_12_BOLD,
  101.                     ""                                // initial text
  102.                 ),
  103.                 FW_REditView    // Last name
  104.                 (
  105.                     kFirstNameEdViewID + 1,            // view id
  106.                     { FW_FIX(290),FW_FIX(110),FW_FIX(450),FW_FIX(127)},
  107.                     FW_kFixedBounds,                // binding
  108.                     20,                                // max chars
  109.                     9,                                // attributes
  110.                     TIMES_12_BOLD,
  111.                     ""                                // initial text
  112.                 ),
  113.                 FW_REditView    // member name
  114.                 (
  115.                     kFirstNameEdViewID + 2,            // view id
  116.                     { FW_FIX(290),FW_FIX(130),FW_FIX(450),FW_FIX(147)},
  117.                     FW_kFixedBounds,                // binding
  118.                     20,                                // max chars
  119.                     9,                                // attributes
  120.                     TIMES_12_BOLD,
  121.                     ""                                // initial text
  122.                 ),
  123.                 FW_REditView    // e-mail address
  124.                 (
  125.                     kFirstNameEdViewID + 3,            // view id
  126.                     { FW_FIX(290),FW_FIX(150),FW_FIX(450),FW_FIX(167)},
  127.                     FW_kFixedBounds,                // binding
  128.                     30,                                // max chars
  129.                     9,                                // attributes
  130.                     TIMES_12_BOLD,
  131.                     ""                                // initial text
  132.                 ),
  133. /**                
  134.                 FW_RScrollBar    // Horizontal scrollbar for text-edit
  135.                 (
  136.                     kEditHScrollBarID,            // view id
  137.                     {FW_FIX(30), FW_FIX(289), FW_FIX(450), FW_FIX(305)},    // bounds 
  138.                     FW_kFixedBounds,            // view binding
  139.                     0,                            // control message
  140.                     0,                            // control receiver
  141.                     0,                            // control value
  142.                     0,                            // SB Min Value (adjusted at runtime)
  143.                     1,                            // SB Max Value (adjusted at runtime)
  144.                     FW_ONE,                        // SB Minor Units (adjusted at runtime)
  145.                     FW_ONE                        // SB Major Units (adjusted at runtime)
  146.                 ),
  147. **/
  148.                 FW_RScrollBar    // Vertical scrollbar for text-edit
  149.                 (
  150.                     kEditVScrollBarID,            // view id
  151.                     {FW_FIX(449), FW_FIX(200), FW_FIX(465), FW_FIX(290)},    // bounds 
  152.                     FW_kFixedBounds,            // view binding
  153.                     0,                            // control message
  154.                     0,                            // control receiver
  155.                     0,                            // control value
  156.                     0,                            // SB Min Value (adjusted at runtime)
  157.                     1,                            // SB Max Value (adjusted at runtime)
  158.                     FW_ONE,                        // SB Minor Units (adjusted at runtime)
  159.                     FW_ONE                        // SB Major Units (adjusted at runtime)
  160.                 ),
  161.                 RScrollEdit        // Comments (custom scrolling edit view)
  162.                 (
  163.                     kFirstNameEdViewID + 4,            // view id
  164.                     { FW_FIX(30),FW_FIX(200),FW_FIX(450),FW_FIX(290)},
  165.                     FW_kFixedBounds,                // binding
  166.                     -1,                                // max chars (32K)
  167.                     13,                                // attributes
  168.                     FW_NORMAL_FONT,
  169.                     "",                                // initial text
  170.                     0, // kEditHScrollBarID,        // Horizontal SB
  171.                     kEditVScrollBarID,                // Vertical SB
  172.                     FW_FIX(600)                        // text width (used only with horiz SB)
  173.                 ),
  174.                 FW_RButton
  175.                 (
  176.                     kSubscribeCheckID,                // view id
  177.                     { FW_FIX(30),FW_FIX(310),FW_FIX(200),FW_FIX(324)},
  178.                     FW_kFixedBounds,                // binding
  179.                     0,                                // control message
  180.                     0,                                // control receiver
  181.                     1,                                // control value
  182.                     FW_kCheckButton,                // button kind
  183.                     TIMES_12_BOLD,
  184.                     "Subscribe to ODFFlash"            
  185.                 ),
  186.                 FW_RGroupBox
  187.                 (
  188.                     0,                                // view id
  189.                     { FW_FIX(30),FW_FIX(360),FW_FIX(220),FW_FIX(440)},
  190.                     FW_kFixedBounds,                // binding
  191.                     TIMES_12_BOLD,
  192.                     "Modem speed used"
  193.                 ),
  194.                 FW_RButton
  195.                 (
  196.                     k14400RadioID,                    // view id
  197.                     { FW_FIX(40),FW_FIX(380),FW_FIX(210),FW_FIX(396)},
  198.                     FW_kFixedBounds,                // binding
  199.                     0,                                // control message
  200.                     0,                                // control receiver
  201.                     0,                                // control value
  202.                     FW_kRadioButton,                // button kind
  203.                     FW_SYSTEM_FONT,
  204.                     "14.4 Kbps or lower"            
  205.                 ),
  206.                 FW_RButton
  207.                 (
  208.                     k28800RadioID,                    // view id
  209.                     { FW_FIX(40),FW_FIX(400),FW_FIX(210),FW_FIX(416)},
  210.                     FW_kFixedBounds,                // binding
  211.                     0,                                // control message
  212.                     0,                                // control receiver
  213.                     1,                                // control value
  214.                     FW_kRadioButton,                // button kind
  215.                     FW_SYSTEM_FONT,
  216.                     "28.8 Kbps to 256 Kbps"            
  217.                 ),
  218.                 FW_RButton
  219.                 (
  220.                     kFasterRadioID,                    // view id
  221.                     { FW_FIX(40),FW_FIX(420),FW_FIX(210),FW_FIX(436)},
  222.                     FW_kFixedBounds,                // binding
  223.                     0,                                // control message
  224.                     0,                                // control receiver
  225.                     0,                                // control value
  226.                     FW_kRadioButton,                // button kind
  227.                     FW_SYSTEM_FONT,
  228.                     "Faster than 256 Kbps"            
  229.                 ),
  230.                 FW_RListBox
  231.                 (
  232.                     kPlatformListBoxID,                // view id
  233.                     { FW_FIX(250),FW_FIX(362),FW_FIX(400),FW_FIX(440)},
  234.                     FW_kFixedBounds,                // binding
  235.                     10,                                // number of rows
  236.                     1,                                // vertical SB
  237.                     0,                                // single selection
  238.                     1,                                // use focus frame
  239.                     0,                                // use clientdata
  240.                     FW_kListBoxDoubleClickedMsg,    // DblClick message
  241.                     FW_HELVETICA12,                    // font
  242.                     {                                // List of strings
  243.                         "Mac OS",
  244.                         "OS/2 Warp",
  245.                         "Windows 95",
  246.                         "Windows NT",
  247.                         "IBM AIX",
  248.                         "Sun Sparc Solaris",
  249.                         "Sun OS 4.1.x",
  250.                         "HP /UX",
  251.                         "Unix IRIX",
  252.                         "Unix Linux"
  253.                     }
  254.                 ),
  255.                 FW_RButton
  256.                 (
  257.                     kAddButtonID,                    // view id
  258.                     { FW_FIX(410),FW_FIX(370),FW_FIX(480),FW_FIX(390)},
  259.                     FW_kFixedBounds,                // binding
  260.                     FW_kButtonPressedMsg,            // control message
  261.                     FW_kFrameReceiver,                // receiver
  262.                     0,                                // control value
  263.                     FW_kPushButton,                    // button kind
  264.                     FW_SYSTEM_FONT,
  265.                     "Add"            
  266.                 ),
  267.                 FW_RButton
  268.                 (
  269.                     kRemoveButtonID,                // view id
  270.                     { FW_FIX(410),FW_FIX(400),FW_FIX(480),FW_FIX(420)},
  271.                     FW_kFixedBounds,                // binding
  272.                     FW_kButtonPressedMsg,            // control message
  273.                     FW_kFrameReceiver,                // receiver
  274.                     0,                                // control value
  275.                     FW_kPushButton,                    // button kind
  276.                     FW_SYSTEM_FONT,
  277.                     "Remove"            
  278.                 ),
  279.                 FW_RPopupMenu
  280.                 (
  281.                     kBrowseTimePopupID,                // view id
  282.                     { FW_FIX(30),FW_FIX(477),FW_FIX(230),FW_FIX(497)},
  283.                     FW_kFixedBounds,                // binding
  284.                     FW_kPopupClickedMsg,            // control message
  285.                     FW_kFrameReceiver,                // control receiver
  286.                     0,                                // control value
  287.                     kBrowseTimeMenuResID,            // Mac menu id
  288.                     0,                                // title width
  289.                     2,                                // Initial menu item
  290.                     0,                                // Menu variation
  291.                     0,                                // Menu refCon    
  292.                     FW_SYSTEM_FONT,
  293.                     ""                                // title
  294.                 ),
  295.                 FW_RPopupMenu
  296.                 (
  297.                     kOnlineTimePopupID,                // view id
  298.                     { FW_FIX(30),FW_FIX(540),FW_FIX(230),FW_FIX(560)},
  299.                     FW_kFixedBounds,                // binding
  300.                     0,                                // control message
  301.                     0,                                // control receiver
  302.                     0,                                // control value
  303.                     kOnlineTimeMenuResID,            // Mac menu id
  304.                     0,                                // title width
  305.                     1,                                // Initial menu item
  306.                     0,                                // Menu variation
  307.                     0,                                // Menu refCon    
  308.                     FW_SYSTEM_FONT,
  309.                     ""                                // title
  310.                 ),
  311.                 FW_RGroupBox
  312.                 (
  313.                     0,                                // view id
  314.                     { FW_FIX(30),FW_FIX(580),FW_FIX(350),FW_FIX(700)},
  315.                     FW_kFixedBounds,                // binding
  316.                     TIMES_12_BOLD,
  317.                     " How did you discover ODFWired?"            
  318.                 ),
  319.                 FW_RButton
  320.                 (
  321.                     kWorldMouthRadioID,                // view id
  322.                     { FW_FIX(40),FW_FIX(600),FW_FIX(300),FW_FIX(616)},
  323.                     FW_kFixedBounds,                // binding
  324.                     0,                                // control message
  325.                     0,                                // control receiver
  326.                     0,                                // control value
  327.                     FW_kRadioButton,                // button kind
  328.                     FW_SYSTEM_FONT,
  329.                     "Word of mouth"            
  330.                 ),
  331.                 FW_RButton
  332.                 (
  333.                     kHyperLinkRadioID,                // view id
  334.                     { FW_FIX(40),FW_FIX(620),FW_FIX(300),FW_FIX(636)},
  335.                     FW_kFixedBounds,                // binding
  336.                     0,                                // control message
  337.                     0,                                // control receiver
  338.                     0,                                // control value
  339.                     FW_kRadioButton,                // button kind
  340.                     FW_SYSTEM_FONT,
  341.                     "Hyperlink from another site:"            
  342.                 ),
  343.                 FW_RButton
  344.                 (
  345.                     kMacTechRadioID,                // view id
  346.                     { FW_FIX(40),FW_FIX(640),FW_FIX(300),FW_FIX(656)},
  347.                     FW_kFixedBounds,                // binding
  348.                     0,                                // control message
  349.                     0,                                // control receiver
  350.                     1,                                // control value
  351.                     FW_kRadioButton,                // button kind
  352.                     FW_SYSTEM_FONT,
  353.                     "Ad in MacTech Magazine"            
  354.                 ),
  355.                 FW_RButton
  356.                 (
  357.                     kMagazineRadioID,                // view id
  358.                     { FW_FIX(40),FW_FIX(660),FW_FIX(300),FW_FIX(676)},
  359.                     FW_kFixedBounds,                // binding
  360.                     0,                                // control message
  361.                     0,                                // control receiver
  362.                     0,                                // control value
  363.                     FW_kRadioButton,                // button kind
  364.                     FW_SYSTEM_FONT,
  365.                     "Other magazine, newspaper, radio"            
  366.                 ),
  367.                 FW_RButton
  368.                 (
  369.                     kOtherRadioID,                    // view id
  370.                     { FW_FIX(40),FW_FIX(680),FW_FIX(300),FW_FIX(696)},
  371.                     FW_kFixedBounds,                // binding
  372.                     0,                                // control message
  373.                     0,                                // control receiver
  374.                     0,                                // control value
  375.                     FW_kRadioButton,                // button kind
  376.                     FW_SYSTEM_FONT,
  377.                     "Other"            
  378.                 ),
  379.                 FW_RButton
  380.                 (
  381.                     kYesRadioID,                    // view id
  382.                     { FW_FIX(40),FW_FIX(725),FW_FIX(100),FW_FIX(740)},
  383.                     FW_kFixedBounds,                // binding
  384.                     0,                                // control message
  385.                     0,                                // control receiver
  386.                     0,                                // control value
  387.                     FW_kRadioButton,                // button kind
  388.                     FW_SYSTEM_FONT,
  389.                     "Yes"            
  390.                 ),
  391.                 FW_RButton
  392.                 (
  393.                     kNoRadioID,                        // view id
  394.                     { FW_FIX(40),FW_FIX(745),FW_FIX(100),FW_FIX(760)},
  395.                     FW_kFixedBounds,                // binding
  396.                     FW_kButtonPressedMsg,            // control message
  397.                     FW_kFrameReceiver,                // control receiver
  398.                     0,                                // control value
  399.                     FW_kRadioButton,                // button kind
  400.                     FW_SYSTEM_FONT,
  401.                     "No"            
  402.                 ),    
  403.                 FW_RButton
  404.                 (
  405.                     kSubscribeButtonID,                // view id
  406.                     { FW_FIX(300),FW_FIX(750),FW_FIX(450),FW_FIX(775)},
  407.                     FW_kFixedBounds,                // binding
  408.                     FW_kButtonPressedMsg,            // control message
  409.                     FW_kFrameReceiver,                // receiver
  410.                     0,                                // control value
  411.                     FW_kPushButton,                    // button kind
  412.                     FW_SYSTEM_FONT,
  413.                     "Join ODFWired!"            
  414.                 )
  415.             },                            // End list of Subviews
  416.             
  417.             // RFormView adds 3 radio-clusters to FW_RSuperView
  418.             FW_RRadioCluster    
  419.             (
  420.                 1,                                    // Dummy field
  421.                 { k14400RadioID, k28800RadioID, kFasterRadioID } // List of radios
  422.             ),
  423.             FW_RRadioCluster    
  424.             (
  425.                 2,                                    // Dummy field
  426.                 { kWorldMouthRadioID, kHyperLinkRadioID, kMacTechRadioID,
  427.                     kMagazineRadioID, kOtherRadioID } // List of radios
  428.             ),
  429.             FW_RRadioCluster    
  430.             (
  431.                 3,                                    // Dummy field
  432.                 { kYesRadioID, kNoRadioID }            // List of radios
  433.             )
  434.         ),                            // End RFormView resource
  435.         FW_RScrollBar        // Horizontal
  436.         (
  437.             kHorzScrollBarID,            // view id
  438.             {-FW_ONE, V - FW_SBSIZE, H1 - FW_SBSIZE, V1},    //  bounds 
  439.             FW_kHScrollBarBinding,        // Standard horizontal SB binding
  440.             0,                            // control message
  441.             0,                            // control receiver
  442.             0,                            // control value
  443.             0,                            // SB Min Value (adjusted at runtime)
  444.             1,                            // SB Max Value (adjusted at runtime)
  445.             FW_ONE,                        // SB Minor Units (adjusted at runtime)
  446.             FW_ONE                        // SB Major Units (adjusted at runtime)
  447.         ),
  448.         FW_RScrollBar        // Vertical
  449.         (
  450.             kVertScrollBarID,            // view id
  451.             {H - FW_SBSIZE, -FW_ONE, H1, V1 - FW_SBSIZE},    // bounds 
  452.             FW_kVScrollBarBinding,        // Standard vertical SB binding
  453.             0,                            // control message
  454.             0,                            // control receiver
  455.             0,                            // control value
  456.             0,                            // SB Min Value (adjusted at runtime)
  457.             1,                            // SB Max Value (adjusted at runtime)
  458.             FW_ONE,                        // SB Minor Units (adjusted at runtime)
  459.             FW_ONE                        // SB Major Units (adjusted at runtime)
  460.         ),
  461.         FW_RGrowBox
  462.         (
  463.             kGrowBoxID,                    // view Id
  464.             {H - FW_SBSIZE, V - FW_SBSIZE, H1, V1},        // bounds
  465.             FW_kGrowBoxBinding            // standard grow box binding
  466.         )
  467.     },                            // End list of frame's subviews
  468.     
  469.     {                        // Scroller
  470.         FW_RScrollBarScroller
  471.         (
  472.             0,                        // AutoScrollInset: not used here
  473.             {0, 0}                    // AutoScrollIncrement: 0 = no auto-scroll 
  474.             kHorzScrollBarID,        // Horizontal scroll-bar ID
  475.             kVertScrollBarID        // Vertical scroll-bar ID
  476.         ) 
  477.     }
  478. };
  479.  
  480. //========================================================================================
  481. // type RPwdEditView
  482. //========================================================================================
  483. // Custom edit view to type hidden passwords
  484.  
  485. type RPwdEditView : FW_REditView(Label='Pwdv')
  486. {
  487. };
  488.  
  489. //========================================================================================
  490. // resource FW_RFrameLayout(kPasswordDialog)
  491. //========================================================================================
  492. // See constants in "FWViews.k", macros & resource types in "FWViews.fr"
  493.  
  494. resource FW_RFrameLayout(kPasswordDialog)
  495. {
  496.     {FW_FIX(100),FW_FIX(100)},        // LayoutSize
  497.     
  498.     {                        // Start list of frame's subviews
  499.         FW_RStaticText
  500.         (
  501.             0,                            // view id
  502.             { FW_FIX(20),FW_FIX(40),FW_FIX(140),FW_FIX(60)},
  503.             FW_kFixedBounds,            // binding
  504.             FW_NORMAL_FONT, 
  505.             "Pick a password:"            
  506.         ),
  507.         FW_RStaticText 
  508.         (
  509.             0,                            // view id
  510.             { FW_FIX(20),FW_FIX(70),FW_FIX(140),FW_FIX(90)},
  511.             FW_kFixedBounds,            // binding
  512.             FW_NORMAL_FONT, 
  513.             "Retype to verify:"            
  514.         ),
  515.         RPwdEditView        // edit view to enter new password
  516.         (
  517.             kPasswordEditID,            // view id
  518.             { FW_FIX(150),FW_FIX(40),FW_FIX(280),FW_FIX(60)},
  519.             FW_kFixedBounds,            // binding
  520.             10,                            // max chars
  521.             9,                            // attributes
  522.             FW_NORMAL_FONT, 
  523.             ""                            // initial text
  524.         ), 
  525.         RPwdEditView        // edit view to confirm password
  526.         (
  527.             kConfirmEditID,                // view id
  528.             { FW_FIX(150),FW_FIX(70),FW_FIX(280),FW_FIX(90)},
  529.             FW_kFixedBounds,            // binding
  530.             10,                            // max chars
  531.             9,                            // attributes
  532.             FW_NORMAL_FONT, 
  533.             ""                            // initial text
  534.         ), 
  535.         FW_RButton
  536.         (
  537.             kOKButtonID,                // view id
  538.             { FW_FIX(180),FW_FIX(120),FW_FIX(260),FW_FIX(148)},
  539.             FW_kFixedBounds,            // binding
  540.             FW_kDefaultButtonMsg,        // "OK" message
  541.             0,                            // receiver = dialogFrame by default
  542.             0,                            // control value
  543.             FW_kDefaultPushButton,        // button kind (with outline)
  544.             FW_NORMAL_FONT,
  545.             "OK"            
  546.         ),
  547.         FW_RButton
  548.         (
  549.             kCancelButtonID,            // view id
  550.             { FW_FIX(60),FW_FIX(123),FW_FIX(120),FW_FIX(145)},
  551.             FW_kFixedBounds,            // binding
  552.             FW_kCancelButtonMsg,        // "Cancel" message
  553.             0,                            // receiver = dialogFrame by default
  554.             0,                            // control value
  555.             FW_kPushButton,                // button kind
  556.             FW_NORMAL_FONT,
  557.             "Cancel"            
  558.         )
  559.     },                        // End list of frame's subviews
  560.     { }                        // no scroller
  561. }; 
  562.